/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tpdisenio2009.model.beans;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author DeuterioX
 */
@Entity
@Table(name = "soccer_player")
@NamedQueries({
    @NamedQuery(name = "SoccerPlayer.findAll", query = "SELECT s FROM SoccerPlayer s")})
public class SoccerPlayer implements Serializable {

    private static final long serialVersionUID = 1L;

    public static final String GOALKEEPER_POSITION = "Arquero";
    public static final String DEFENDER_POSITION = "Defensor";
    public static final String MIDFIELDER_POSITION = "Volante";
    public static final String FORWARD_POSITION = "Delantero";

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;

    @Basic(optional = false)
    @Column(name = "first_name", nullable=false)
    private String firstName;

    @Basic(optional = false)
    @Column(name = "last_name", nullable=false)
    private String lastName;

    @Basic(optional = false)
    @Column(name = "position", nullable=false)
    private String position;

    @Basic(optional = false)
    @Column(name = "price", nullable=false)
    private int price;

    @Basic(optional = false)
    @Column(name = "shirt_number")
    private Integer shirtNumber;

    @ManyToOne
    @Basic(optional = false)
    private RealTeam realTeam;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "soccerPlayer")
    private Collection<Score> scoreCollection;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "soccerPlayer")
    private Collection<FantasyTeamPlayer> fantasyTeamPlayerCollection;

    public SoccerPlayer() {
    }

    public SoccerPlayer(Integer id) {
        this.id = id;
    }

    public SoccerPlayer(Integer id, String firstName, String lastName, String position, int price, RealTeam realTeam) {
        this.id = id;
        this.firstName = firstName;
        this.lastName = lastName;
        this.position = position;
        this.price = price;
        this.realTeam = realTeam;
    }


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public Integer getShirtNumber() {
        return shirtNumber;
    }

    public void setShirtNumber(Integer shirtNumber) {
        this.shirtNumber = shirtNumber;
    }

    public RealTeam getRealTeam() {
        return realTeam;
    }

    public void setRealTeam(RealTeam realTeam) {
        this.realTeam = realTeam;
    }

    public Collection<Score> getScoreCollection() {
        return scoreCollection;
    }

    public void setScoreCollection(Collection<Score> scoreCollection) {
        this.scoreCollection = scoreCollection;
    }

    public Collection<FantasyTeamPlayer> getFantasyTeamPlayerCollection() {
        return fantasyTeamPlayerCollection;
    }

    public void setFantasyTeamPlayerCollection(Collection<FantasyTeamPlayer> fantasyTeamPlayerCollection) {
        this.fantasyTeamPlayerCollection = fantasyTeamPlayerCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SoccerPlayer)) {
            return false;
        }
        SoccerPlayer other = (SoccerPlayer) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tpdisenio2009.model.beans.SoccerPlayer[id=" + id + "]";
    }

}
